package config

import (
	"tlsx"

	"github.com/cloudwego/hertz/pkg/app/server"
	"github.com/cloudwego/hertz/pkg/common/tracer/stats"
	"github.com/cloudwego/hertz/pkg/network/netpoll"
	"github.com/cloudwego/hertz/pkg/protocol/suite"
)

func NewHttp(addr string) *server.Hertz {
	cfg := tlsx.TlsCfg(suite.HTTP1)
	h := server.Default(
		server.WithTraceLevel(stats.LevelDisabled),
		server.WithTLS(cfg),
		server.WithAltTransport(netpoll.NewTransporter),
		server.WithHostPorts(addr),
	)
	return h
}
